DATA TYPES



What are Data Types?

Data type is a memory storing place. It is used to avoid wastage of memory and unnecessary use of memory. A data type stores a particular type of data.


Integer

Integer data type includes all the negative values, positive values and zero.


Input Output
#include<stdio.h>
main()
{
int a,b,c,d,e;
clrscr();
a=10;
b=20;
c=30;
d=40;
e=50;
printf("%d\n%d\n%d\n%d\n%d",a,b,c,d,e);
}



Float

Float data type includes all the integer values as well as decimal values.

Input Output
#include<stdio.h>
main()
{
float a,b,c,d,e;
clrscr();
a=10.5;
b=20.6;
c=30.7;
d=40.8;
e=50.9;
printf("%f\n%f\n%f\n%f\n%f",a,b,c,d,e);
}



Character

Character data type includes letters, numbers and symbols.

Input Output
#include<stdio.h>
main()
{
char aman;
clrscr();
aman='a';
printf("%c",aman);
}

Input Output
#include<stdio.h>
main()
{
char a,b,c,d,e;
clrscr();
a='9';
b='-';
c='1';
d='=';
e='8';
printf("%c%c%c%c%c",a,b,c,d,e);
}



String

String data type includes collection of letters, numbers and symbols.

Input Output
#include<stdio.h>
main()
{
char a1[10]="yashita";
clrscr();
printf("%s",a1);
}